//
//  WMERequestData.m
//  WMEMusic
//
//  Created by 恩叔 on 16/5/2.
//  Copyright © 2016年 enshu. All rights reserved.
//

#import "WMERequestData.h"

@implementation WMERequestData

+ (void)requestDataURL:(NSString *)URLStr block:(void (^)(NSArray *))bloak
{
    [WMEAFNetworking GETNetWithUrl:URLStr body:nil headerFile:nil response:WMEDATA success:^(id result) {
        NSString *str = result;
        [self musicModelRequest:str];
    } failure:^(NSError *error) {
        NSLog(@"网络请求错误");
    }];
}


+ (void)musicModelRequest:(NSString *)str{
    //歌词和时间数组
    NSArray *arr = [str componentsSeparatedByString:@"\n"];
    //歌词时间数组
    NSMutableArray *timerMutableArray = [NSMutableArray array];
    //歌词数组
    NSMutableArray *lysicMutableArray = [NSMutableArray array];
    
    for (NSString *string in arr) {
        
        //拆分时间和歌词
        NSArray *timeAndLyric = [string componentsSeparatedByString:@"]"];
        //拆分时间
        NSArray *timerArray = [timeAndLyric.firstObject componentsSeparatedByString:@"["];
        //添加时间
        [timerMutableArray addObject:timerArray.lastObject];
        //添加歌词
        [lysicMutableArray addObject:timeAndLyric.lastObject];
    }
    
}

@end
